package cn.wolfcode.plus.util;

import org.springframework.http.HttpStatus;

public enum ErrorCode {

    RESOURCE_NOT_FOUND(1001, HttpStatus.NOT_FOUND,"未找到该资源"),
    request_validation(1002, HttpStatus.BAD_REQUEST,"请求参数格式验证失败");
    
    // 异常的唯一标识
    private int code;
    // HTTP状态码
    private HttpStatus status;
    // 异常信息
    private String message;

    ErrorCode(int code, HttpStatus status, String message) {
        this.code = code;
        this.status = status;
        this.message = message;
    }

    public int getCode() {
        return code;
    }

    public HttpStatus getStatus() {
        return status;
    }

    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return "ErrorCode{" +
                "code=" + code +
                ", status=" + status +
                ", message='" + message + '\'' +
                '}';
    }
}
